package io.coderyeah.pet.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.coderyeah.org.domain.Shop;
import io.coderyeah.user.domain.User;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @TableName t_pet
 */
@TableName(value = "t_pet")
@Data
public class Pet implements Serializable {

    @TableId(type = IdType.AUTO)
    private Long id;


    private String name;

    private BigDecimal costprice;


    private BigDecimal saleprice;

    /**
     * 类型id
     */
    private Long typeId;

    private String resources;

    /**
     * 状态：0下架 1上架
     */
    private Integer state = 0;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date offsaletime;


    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date onsaletime;


    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createtime = new Date();

    /**
     * 店铺Id 如果被领养店铺id为null
     */
    private Long shopId;

    /**
     * 如果被领养为领养用户id
     */
    private Long userId;

    private Long searchMasterMsgId;

    // 宠物类型
    @TableField(exist = false)
    private PetType petType;

    // 宠物所属商店
    @TableField(exist = false)
    private Shop shop;

    // 宠物领养人
    @TableField(exist = false)
    private User user;

    /**
     * 宠物详情
     */
    @TableField(exist = false)
    private PetDetail petDetail;
}